package org.codeart.apipassenger.controller;

import org.codeart.apipassenger.remote.ServiceOrderClient;
import org.codeart.common.util.HttpStatus;
import org.codeart.common.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    
    @Autowired
    private ServiceOrderClient serviceOrderClient;

    @GetMapping("/real-time-order/{orderId}")
    public R<Void> dispatchOrder(@PathVariable("orderId") Long orderId) {
        R<Void> r = serviceOrderClient.dispatchOrder(orderId);
        if (r.getCode() == HttpStatus.HTTP_OK) {
            return R.ok();
        }
        return R.fail();
    }

}
